package duaxe.home.entity.projectile;

import java.util.Collections;

import duaxe.home.Graphics.Screen;
import duaxe.home.Graphics.Sprite;

public class WizardProjectile extends Projectile {
	public static final int File_Rate =5;

	public WizardProjectile(int x, int y, int dir) {

		super(x, y, dir);
		range = 100;
		damage = 20;
		speed = 4;
		sprite = Sprite.projectile_wizard;
		nx = speed * Math.cos(angel);
		ny = speed * Math.sin(angel);
	}
	public void update() {
		move();
		if(level.tilecollision(x,y, nx,ny, 7)){
			remove();
		}
	}
	public void move(){
		x+=nx;
		y+=ny;
		if(distance()>range){
			remove();
		}
		
	}
	private double distance() {
		//khoang cach
		//goc
		double dist=0;
		dist = Math.sqrt(Math.abs((xOrigin -x)*(xOrigin-x)+ (yOrigin-y)*(yOrigin -y)));
		return dist;
	}

	public void render(Screen screen){
		screen.renderProjectile((int)x-3, (int)y-5, this);
	}

}